using Autodesk.Windows;
using Newtonsoft.Json;
using System;
namespace AcadRibbon.Ribbons.Json;

/// <summary>
/// 按钮提示转换
/// </summary>
internal class RibbonToolTipConverter : JsonConverter
{
    public override bool CanConvert(Type objectType)
    {
        return objectType == typeof(object);
    }

    public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
    {
        if (reader.Path == "ToolTip" && reader.Value != null)
        {
            var toolTip = new RibbonToolTip();
            serializer.Populate(reader, toolTip);
            return toolTip;
        }
        return null;
    }

    public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
    {
        throw new NotImplementedException();
    }
}